export function addClass(el,classname){
  let newclass = el.className.split(' ');
  newclass.push(classname);
  el.className = newclass.join(' ');
}

export function getData(el,name,val){
  if(val){
    return el.dataset[name] = val;
  }
  return el.dataset[name];
}


let div = document.createElement('div').style;
let vendor = (()=>{
  let transformNames = {
    standar:'transform',
    ms:'msTransform',
    Moz:'MozTransform',
    webkit:'webkitTransform',
    O:'OTransform'
  }
  for(var key in transformNames){
    if(div[transformNames[key]] !== undefined){
      return key;
    }
    return false;
  }
})()

export function prefixStyle(style){
  if(!vendor){
    return false;
  }
  if(vendor === 'standar'){
    return style
  }
  return vendor + style.charAt(0).toUpperCase() + style.substr(1);
}